﻿using System;
using Be.Timvw.Framework.Domain.Ranges;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Be.Timvw.Framework.Domain.Effectivity
{
    /// <summary>
    /// Specifications for the construction of effectivities.
    /// </summary>
    [TestClass]
    public class WhenConstructingEffectivities
    {
        /// <summary>
        /// Should correctly set the element and period.
        /// </summary>
        [TestMethod]
        public void ShouldCorrectlySetElementAndPeriod()
        {
            string name = "me";
            DateTime begin = new DateTime(2000, 1, 1);
            DateTime end = new DateTime(2000, 12, 31);
            IRange<DateTime> period = new Range<DateTime>(begin, end);

            IEffectivity<string> effectivity = new Effectivity<string>(name, period);
            string actualElement = effectivity.Element;
            IRange<DateTime> actualValidityPeriod = effectivity.Period;

            string expectedElement = name;
            IRange<DateTime> expectedValidityPeriod = period;

            Assert.AreEqual(expectedElement, actualElement);
            Assert.AreEqual(expectedValidityPeriod, actualValidityPeriod);
        }
    }
}